package com.sicheng.lc.周赛.分类.哈西表or计数or滑动窗口or双指针.双指针;

/**
 * @author zsc
 * @version 1.0
 * @date 2022/7/6 21:21
 */
public class 股票平滑下跌阶段的数目 {
    //https://leetcode.cn/problems/number-of-smooth-descent-periods-of-a-stock/
    public long getDescentPeriods(int[] prices) {
        int l = 0;
        long res = 1;
        for (int r = 1; r < prices.length; r++) {
            if (prices[r] - prices[r - 1] != -1)
                l = r;
            res += r - l + 1;
        }
        return res;
    }
}
